#include<cstdio>

void isYuiShu(int n,int m){
	int count=0;
	if(n==1||n==2){
		for(int v=1;v<=m;v++){
			if(n%v==0){
				count++;
			}
		}
		if(count%2==1){
			printf("%4d",n);
		}
	}
	else{
		int count1=0;
		for(int v=1;v<=m;v++){
			if(n%v==0){
				count++;
			}
			if((n%v)-1==0){
				count++;
			}
		}
		if(count%2==1){
			printf("%4d",n);
		}
		if(count1%2==1){
			printf("%4d",n+1);
		}
	}
}

int main(){
	int n;
	int m;
	scanf("%d %d",&n,&m);
	int count2=0;
	for(int y=0;y<=m;y++){
		isYuiShu(y,n);
		count2++;
		if(count2%5==0){
			printf("\n");
		}
	}
}
